]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Avoid redundant boundingBox copies in window layout
authorAndre Nijman <andre.perth.2010@gmail.com>
Mon, 8 Jun 2026 05:45:01 +0000 (13:45 +0800)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 29 Jun 2026 17:47:57 +0000 (19:47 +0200)
WorkspaceLayout's allocation reads child.boundingBox four times for each
window on every frame of an overview transition. The getter returns a
fresh copy of the cached box on every access, so this is four throwaway
objects per window per frame feeding the garbage collector.

Read the box into a local once and use that. The values are identical;
only the per-frame allocations go away.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4250>
(cherry picked from commit d4b5bc781535104475fba490fccfb0dd7934c96f)

js/ui/workspace.js

index 5c043e4bed6400d1b9a950a65a84d171a5152c80..3c8ed9f4108d67b70228f0aa324a6270dc4d070d 100644 (file)
@@ -707,10 +707,11 @@ export const WorkspaceLayout = GObject.registerClass({
             let workspaceBoxWidth, workspaceBoxHeight;
 
             if (windowInfo.metaWindow.showing_on_its_workspace()) {
-                workspaceBoxX = (child.boundingBox.x - workareaX) * allocationScale;
-                workspaceBoxY = (child.boundingBox.y - workareaY) * allocationScale;
-                workspaceBoxWidth = child.boundingBox.width * allocationScale;
-                workspaceBoxHeight = child.boundingBox.height * allocationScale;
+                const {boundingBox} = child;
+                workspaceBoxX = (boundingBox.x - workareaX) * allocationScale;
+                workspaceBoxY = (boundingBox.y - workareaY) * allocationScale;
+                workspaceBoxWidth = boundingBox.width * allocationScale;
+                workspaceBoxHeight = boundingBox.height * allocationScale;
             } else {
                 workspaceBoxX = workareaX * allocationScale;
                 workspaceBoxY = workareaY * allocationScale;